/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/*
常量路由
需要被静态注册, 不需要进行用户权限的检查
*/
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard'),
      meta: { title: '首页', icon: 'dashboard' }
    }]
  }

  // {
  //   path: '/govern',
  //   component: Layout,
  //   redirect: 'govern',
  //   meta: { title: '数据治理', icon: 'table' },
  //   alwaysShow: true,
  //   children: [
  //     {
  //       path: 'govern/governList',
  //       name: '数据治理',
  //       component: () => import('@/views/govern/governList'),
  //       meta: { title: '数据治理' }
  //     },
  //     {
  //       path: 'govern/tableList',
  //       name: '数据监控',
  //       component: () => import('@/views/govern/tableList'),
  //       meta: { title: '数据监控' }
  //     },
  //   ]
  // }
]

/*
所有需要权限的异步路由
某个登陆用户可能需要从中过滤出其中一部分动态注册
router.addRoutes(routes)
*/
export const asyncRoutes = [

  /* 权限管理 */
  {
    name: 'Acl',
    path: '/acl',
    component: Layout,
    redirect: '/acl/admin/list',
    meta: {
      title: '权限管理',
      icon: 'el-icon-lock'
    },
    children: [
      {
        name: 'User',
        path: 'admin/list',
        component: () => import('@/views/acl/admin/list'),
        meta: {
          title: '用户管理'
        }
      },
      {
        name: 'Role',
        path: 'role/list',
        component: () => import('@/views/acl/role/list'),
        meta: {
          title: '角色管理'
        }
      },
      {
        name: 'RoleAuth',
        path: 'role/auth/:id',
        component: () => import('@/views/acl/role/roleAuth'),
        meta: {
          activeMenu: '/acl/role/list',
          title: '角色授权'
        },
        hidden: true
      },
      {
        name: 'Permission',
        path: 'permission/list',
        component: () => import('@/views/acl/permission/list'),
        meta: {
          title: '菜单管理'
        }
      }
    ]
  },

  // {
  //   path: '/dataaccess',
  //   name: 'dataaccess',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   meta: { title: '数据接入', icon: 'table' },
  //   alwaysShow: true,
  //   children: [
  //     {
  //       path: 'dataaccess/mysqlConnector',
  //       name: 'mysql',
  //       component: () => import('@/views/dataaccess/mysqlConnector'),
  //       meta: { title: 'mysql' }
  //     },
  //     {
  //       path: 'dataaccess/postgreSQLConnector',
  //       name: 'postgreSQL',
  //       component: () => import('@/views/dataaccess/postgreSQLConnector'),
  //       meta: { title: 'postgreSQL' }
  //     },
  //     {
  //       path: 'dataaccess/mongoDBConnector',
  //       name: 'mongoDB',
  //       component: () => import('@/views/dataaccess/mongoDBConnector'),
  //       meta: { title: 'mongoDB' }
  //     },
  //     {
  //       path: 'dataaccess/sqlServerConnector',
  //       name: 'sqlServer',
  //       component: () => import('@/views/dataaccess/sqlServerConnector'),
  //       meta: { title: 'sqlServer' }
  //     }
  //     // {
  //     //   path: 'dataaccess/oracleConnector',
  //     //   name: 'oracleServer',
  //     //   component: () => import('@/views/dataaccess/oracleConnector'),
  //     //   meta: { title: 'oracleServer' }
  //     // }
  //   ]
  // },

  {
    path: '/statistics',
    name: 'statistics',
    component: Layout,
    redirect: 'noredirect',
    meta: { title: '统计管理', icon: 'table' },
    alwaysShow: true,
    children: [
      {
        path: 'real',
        name: 'real',
        component: () => import('@/views/statistics/real/realTime'),
        meta: { title: '实时统计' }
      },
      // {
      //   path: 'echarts/sugar',
      //   name: 'sugar',
      //   component: () => import('@/views/statistics/echarts/realtime/sugar'),
      //   meta: { title: 'sugar' }
      // },
      {
        path: 'visit',
        name: 'visit',
        component: () => import('@/views/statistics/visit/visit'),
        meta: { title: '访问流量统计' }
      },
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/statistics/user/user'),
        meta: { title: '会员统计' }
      },
      {
        path: 'echarts/goods',
        name: 'goods',
        component: () => import('@/views/statistics/goods/goods'),
        meta: { title: '商品分析' }
      },
      {
        path: 'echarts/order',
        name: 'order',
        component: () => import('@/views/statistics/order/order'),
        meta: { title: '订单统计' }
      },
      {
        path: 'echarts/activityTable',
        name: 'activityTable',
        component: () => import('@/views/statistics/activity/activityTable'),
        meta: { title: '活动分析' }
      }
      ,
      {
        path: 'echarts/couponTable',
        name: 'couponTable',
        component: () => import('@/views/statistics/coupon/couponTable'),
        meta: { title: '优惠券分析' }
      }
    ]
  },

  {
    path: '/report',
    name: 'report',
    component: Layout,
    redirect: 'noredirect',
    meta: { title: '报表管理', icon: 'table' },
    alwaysShow: true,
    children: [
      {
        path: 'report/customQuery',
        name: 'customQuery',
        component: () => import('@/views/report/customQuery'),
        meta: { title: '报表管理' }
      },
    ]
  },
  {
    path: '/schedule',
    name: 'schedule',
    component: Layout,
    redirect: 'schedule',
    meta: { title: '任务调度', icon: 'table' },
    alwaysShow: true,
    children: [
      {
        path: 'schedule/scheduleList',
        name: 'scheduleList',
        component: () => import('@/views/schedule/scheduleList'),
        meta: { title: '调度' }
      }
    ]
  },
  {
    path: '/govern',
    name: "govern",
    component: Layout,
    redirect: 'govern',
    meta: { title: '数据治理', icon: 'table' },
    alwaysShow: true,
    children: [
      {
        path: 'govern/governList',
        name: 'governList',
        component: () => import('@/views/govern/governList'),
        meta: { title: '数据治理' }
      }
    ]
  },
  {
    path: '/assets',
    name: "assets",
    component: Layout,
    redirect: 'assets',
    meta: { title: '数据资产', icon: 'table' },
    alwaysShow: true,
    children: [
      {
        path: 'assets/tableList',
        name: 'tableList',
        component: () => import('@/views/assets/tableList'),
        meta: { title: '数据管理' }
      },
      {
        path: 'assets/detail',
        name: 'detail',
        //隐藏掉菜单栏
        hidden: true,
        component: () => import('@/views/assets/detail'),
        meta: { title: '数据详情' }
      }
    ]
  },
  {
    path: '/monitor',
    name: "monitor",
    component: Layout,
    redirect: 'monitor',
    meta: { title: '数据监控', icon: 'table' },
    alwaysShow: true,
    children: [
      {
        path: 'monitor/tableList',
        name: 'tableList',
        component: () => import('@/views/monitor/tableList'),
        meta: { title: '监控管理' }
      },
      {
        path: 'monitor/monitorList',
        name: 'monitorList',
        //隐藏掉菜单栏
        hidden: true,
        component: () => import('@/views/monitor/monitorList'),
        meta: { title: '监控' }
      }
    ]
  }
]

/*
必须在最后被动态注册
*/
export const anyRoute = { path: '*', redirect: '/404', hidden: true }
